/**
 * 实现左侧下拉
 */
$(function () {
    $('.navigation ul').hide();
    $('.navigation li a:first-child').click(function () {
        $(this).css({"color": "black"});
        $(this).siblings().toggle();
    })
})

$(function () {
    /*展示（基本信息）患者信息*/
    $.ajax({
        url: "../../QueryFieldAnnotations/selectPtientInformationSheet",
        type: "post",
        dataType: "json",
        success: function (map) {
            /**
             * 基本信息-患者信息
             */
            var spanStrPatient = "";
            var patient = map.patient;
            for (var i = 1; i < patient.length; i++) {
                if (patient[i].column_comment.lastIndexOf("id") == -1) {
                    var indexState = patient[i].column_comment.indexOf("（");
                    var indexEnd = patient[i].column_comment.lastIndexOf("）");
                    var columnComment = patient[i].column_comment.substring(indexState, indexEnd + 1);
                    spanStrPatient += "<li><input type='checkbox' id='patient" + i + "' name='xz' value='" + patient[i].columnName + "," + patient[i].column_comment.replace(columnComment, '') + "' />";
                    spanStrPatient += "<label for='patient" + i + "'>" + patient[i].column_comment.replace(columnComment, '') + "</label>"
                    spanStrPatient += "</li>";
                }
            }
            $("#basic_patient_level1").append(spanStrPatient);
            /**
             * 基本信息-就诊费用
             */
            var spanStrCharge = "";
            var charge = map.charge;
            for (var i = 1; i < charge.length; i++) {
                if (charge[i].column_comment.lastIndexOf("id") == -1) {
                    var indexState = charge[i].column_comment.indexOf("（");
                    var indexEnd = charge[i].column_comment.lastIndexOf("）");
                    var columnComment = charge[i].column_comment.substring(indexState, indexEnd + 1);
                    spanStrCharge += "<li><input type='checkbox' id='charge" + i + "' name='xz' value='" + charge[i].columnName + "," + charge[i].column_comment.replace(columnComment, '') + "' /><label for='charge" + i + "'>" + charge[i].column_comment.replace(columnComment, '') + "</label></li>";
                }
            }
            $("#basic_doctor_cost_level1").append(spanStrCharge);

            /**
             * 基本信息-就诊信息
             */
            var spanStrDiagnosis = "";
            var diagnosis = map.diagnosis;
            for (var i = 1; i < diagnosis.length; i++) {
                if (diagnosis[i].column_comment.lastIndexOf("id") == -1) {
                    var indexState = diagnosis[i].column_comment.indexOf("（");
                    var indexEnd = diagnosis[i].column_comment.lastIndexOf("）");
                    var columnComment = diagnosis[i].column_comment.substring(indexState, indexEnd + 1);
                    spanStrDiagnosis += "<li><input type='checkbox' id='diagnosis" + i + "' name='xz' value='" + diagnosis[i].columnName + "," + diagnosis[i].column_comment.replace(columnComment, '') + "' /><label for='diagnosis" + i + "'>" + diagnosis[i].column_comment.replace(columnComment, '') + "</label></li>";
                }
            }
            $("#basic_doctor_level1").append(spanStrDiagnosis);

            /**
             * 健康档案-手术信息
             */
            var spanStrOperationInformationSheet = "";
            var operationInformationSheet = map.operationInformationSheet;
            for (var i = 1; i < operationInformationSheet.length; i++) {
                if (operationInformationSheet[i].column_comment.lastIndexOf("id") == -1) {
                    var indexState = operationInformationSheet[i].column_comment.indexOf("（");
                    var indexEnd = operationInformationSheet[i].column_comment.lastIndexOf("）");
                    var columnComment = operationInformationSheet[i].column_comment.substring(indexState, indexEnd + 1);
                    spanStrOperationInformationSheet += "<li><input type='checkbox' id='operationInformationSheet" + i + "' name='xz' value='" + operationInformationSheet[i].columnName + "," + operationInformationSheet[i].column_comment.replace(columnComment, '') + "' /><label for='operationInformationSheet" + i + "'>" + operationInformationSheet[i].column_comment.replace(columnComment, '') + "</label></li>";
                }
            }
            $("#health_surgery_cost_level1").append(spanStrOperationInformationSheet);

            /**
             * 健康档案-输血信息
             */
            var spanStrBloodTransfusionRecord = "";
            var bloodTransfusionRecord = map.bloodTransfusionRecord;
            for (var i = 1; i < bloodTransfusionRecord.length; i++) {
                if (bloodTransfusionRecord[i].column_comment.lastIndexOf("id") == -1) {
                    var indexState = bloodTransfusionRecord[i].column_comment.indexOf("（");
                    var indexEnd = bloodTransfusionRecord[i].column_comment.lastIndexOf("）");
                    var columnComment = bloodTransfusionRecord[i].column_comment.substring(indexState, indexEnd + 1);
                    spanStrBloodTransfusionRecord += "<li><input type='checkbox' id='bloodTransfusionRecord" + i + "' name='xz' value='" + bloodTransfusionRecord[i].columnName + "," + bloodTransfusionRecord[i].column_comment.replace(columnComment, '') + "' /><label for='bloodTransfusionRecord" + i + "'>" + bloodTransfusionRecord[i].column_comment.replace(columnComment, '') + "</label></li>";
                }
            }
            $("#health_blood_cost_level1").append(spanStrBloodTransfusionRecord);

            /**
             * 临床检验-检验报告
             */
            var spanStrPathologicalReport = "";
            var pathologicalReport = map.pathologicalReport;
            for (var i = 1; i < pathologicalReport.length; i++) {
                if (pathologicalReport[i].column_comment.lastIndexOf("id") == -1) {
                    var indexState = pathologicalReport[i].column_comment.indexOf("（");
                    var indexEnd = pathologicalReport[i].column_comment.lastIndexOf("）");
                    var columnComment = pathologicalReport[i].column_comment.substring(indexState, indexEnd + 1);
                    spanStrPathologicalReport += "<li><input type='checkbox' id='pathologicalReport" + i + "' name='xz' value='" + pathologicalReport[i].columnName + "," + pathologicalReport[i].column_comment.replace(columnComment, '') + "' /><label for='pathologicalReport" + i + "'>" + pathologicalReport[i].column_comment.replace(columnComment, '') + "</label></li>";
                }
            }
            $("#basic_inspection_level1").append(spanStrPathologicalReport);

            /**
             * 临床检验-检验报告
             */
            var spanStrAnemia = "";
            var anemia = map.anemia;
            for (var i = 1; i < anemia.length; i++) {
                if (anemia[i].column_comment.lastIndexOf("id") == -1) {
                    var indexState = anemia[i].column_comment.indexOf("（");
                    var indexEnd = anemia[i].column_comment.lastIndexOf("）");
                    var columnComment = anemia[i].column_comment.substring(indexState, indexEnd + 1);
                    spanStrAnemia += "<li><input type='checkbox' id='anemia" + i + "' name='xz' value='" + anemia[i].columnName + "," + anemia[i].column_comment.replace(columnComment, '') + "' /><label for='anemia" + i + "'>" + anemia[i].column_comment.replace(columnComment, '') + "</label></li>";
                }
            }
            $("#basic_results_level1").append(spanStrAnemia);
        }
    })
})
